﻿/*
   绑定视图：MainNotice.xaml
   文件说明：通知消息
*/

using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.Messaging;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZFSDomain.Common.UserControls;
using ZFSDomain.Common.UserControls.Common;
using ZFSDomain.Interface.User;
using ZFSDomain.Service;
using ZFSDomain.SysModule;

namespace ZFSDomain.ViewModel.Step
{
    public class NoticeViewModel : BaseDialogOperation
    {
        public NoticeViewModel()
        {
            _NoticeModels = new ObservableCollection<NoticeModel>();
            _NoticeModels.Add(new NoticeModel() { IconName = "\xe625", Count = "3", ApplyCommand = NoticeCommand });
            _NoticeModels.Add(new NoticeModel() { IconName = "\xe608", Count = "14", ApplyCommand = MessageCommand });
        }

        private ObservableCollection<NoticeModel> _NoticeModels;

        public ObservableCollection<NoticeModel> NoticeModels
        {
            get { return _NoticeModels; }
        }
        
        public RelayCommand NoticeCommand { get; } = new RelayCommand(() => OpenNotice());

        public RelayCommand MessageCommand { get; } = new RelayCommand(() => OpenMessage());

        public static StateType _StateType = StateType.PackUp;
        

        public static void OpenNotice()
        {
            NoticeViewModel view = new NoticeViewModel();
            var Dialog = ServiceProvider.Instance.Get<INoticeDialog>();
            Dialog.BindViewModel(view);
            Dialog.ShowDialog(view.ExtendedOpenedEventHandler, view.ExtendedClosingEventHandler);
        }

        public static void OpenMessage()
        {
            MessagesBoxViewModel view = new MessagesBoxViewModel();
            var Dialog = ServiceProvider.Instance.Get<IMessagesBoxDialog>();
            Dialog.BindViewModel(view);
            Dialog.ShowDialog(view.ExtendedOpenedEventHandler,view.ExtendedClosingEventHandler);
        }

    }

    public enum StateType
    {
        /// <summary>
        /// 收起
        /// </summary>
        PackUp,

        /// <summary>
        /// 展开
        /// </summary>
        Expand,
    }

    /// <summary>
    /// 通知窗口类型
    /// </summary>
    public class NoticeModel : ViewModelBase
    {
        private string _IconName;
        private string _Count;

        /// <summary>
        /// 字体代码[显示LOGO]
        /// </summary>
        public string IconName
        {
            get { return _IconName; }
            set { _IconName = value; RaisePropertyChanged(); }
        }

        /// <summary>
        /// 功能名称
        /// </summary>
        public string Count
        {
            get { return _Count; }
            set
            {
                _Count = value; RaisePropertyChanged();
            }
        }

        public RelayCommand ApplyCommand { get; set; }
    }
}
